package com.mini.cn.goods.util;

import java.math.BigDecimal;

/**
 * Created by fly on 17/5/25.
 */
public class MoneyUtil {

    /**
     * 转换double 取后两位
     * @param f
     * @return
     */
    public static double coverTwoMoney(double f){
        BigDecimal b   =   new   BigDecimal(f);
        double   f1   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();
        return f1;
    }


    public static void main(String args[]){
       MoneyUtil.coverTwoMoney(0.1111);
    }
}
